package com.fansaikj.erp.domain;

/*
 * Copyright © 2020-2035 erupt.xyz All rights reserved.
 * Author: YuePeng (erupts@126.com)
 */

import com.fansaikj.erp.domain.comtactCompany.SupplierCompany;
import lombok.Data;
import lombok.EqualsAndHashCode;
import xyz.erupt.annotation.Erupt;
import xyz.erupt.annotation.EruptField;
import xyz.erupt.annotation.sub_field.Edit;
import xyz.erupt.annotation.sub_field.EditType;
import xyz.erupt.annotation.sub_field.View;
import xyz.erupt.annotation.sub_field.sub_edit.*;
import xyz.erupt.jpa.model.BaseModel;

import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import java.util.Date;

@EqualsAndHashCode(callSuper = true)
@Erupt(name = "供应商应收")
@Table(name = "erp_supplier_account_book")
@Entity
@Data
public class SupplierAccountBook extends BaseModel {

    @EruptField(
            views = @View(
                    title = "", show = false
            ),
            edit = @Edit(
                    title = "",
                    type = EditType.INPUT, show = false, notNull = true,
                    inputType = @InputType
            )
    )
    private Long id;

    @EruptField(
            views = @View(
                    title = "供应商",
                    column = "name"
            ),
            edit = @Edit(
                    title = "供应商",
                    type = EditType.REFERENCE_TABLE, search = @Search, notNull = true,
                    referenceTableType = @ReferenceTableType(id = "id", label = "name")
            )
    )
    @ManyToOne
    private SupplierCompany supplier;

    @EruptField(
            views = @View(
                    title = "应付总金额"
            ),
            edit = @Edit(
                    title = "应付总金额",
                    type = EditType.NUMBER, notNull = true,
                    numberType = @NumberType
            )
    )
    private Integer payable;

    @EruptField(
            views = @View(
                    title = "已付金额"
            ),
            edit = @Edit(
                    title = "已付金额",
                    type = EditType.NUMBER, notNull = true,
                    numberType = @NumberType
            )
    )
    private Integer paid;

    @EruptField(
            views = @View(
                    title = "创建人", show = false
            ),
            edit = @Edit(
                    title = "创建人",
                    type = EditType.INPUT, show = false,
                    inputType = @InputType
            )
    )
    private String createBy;

    @EruptField(
            views = @View(
                    title = "创建日期", show = false
            ),
            edit = @Edit(
                    title = "创建日期",
                    type = EditType.DATE, show = false,
                    dateType = @DateType
            )
    )
    private Date createTime;

    @EruptField(
            views = @View(
                    title = "更新人", show = false
            ),
            edit = @Edit(
                    title = "更新人",
                    type = EditType.INPUT, show = false,
                    inputType = @InputType
            )
    )
    private String updateBy;

    @EruptField(
            views = @View(
                    title = "更新日期", show = false
            ),
            edit = @Edit(
                    title = "更新日期",
                    type = EditType.DATE, show = false,
                    dateType = @DateType
            )
    )
    private Date updateTime;

    @EruptField(
            views = @View(
                    title = "所属部门"
            ),
            edit = @Edit(
                    title = "所属部门",
                    type = EditType.INPUT,
                    inputType = @InputType
            )
    )
    private String sysOrgCode;

    @EruptField(
            views = @View(
                    title = "删除状态(0-正常,1-已删除)", show = false
            ),
            edit = @Edit(
                    title = "删除状态(0-正常,1-已删除)",
                    type = EditType.INPUT, show = false,
                    inputType = @InputType
            )
    )
    private String delFlag;

}